
#include <stdio.h>
#include <string.h>
#include "spi.h"
#include "sysdef.h"
#include "appload.h"
#include "device.h"

void spi_example(void *argv) {
    argv = argv;
    char *str = "Hello world!\r\n";
    char buf[16] = {0};
    spi_t *spi = spi_find_by_port(SPI_PORT0);

    printf("Found spi dev %p\r\n", spi);

    printf("spi write: %s", str);
    spi->write_read(str, buf, strlen(str));
    printf("spi read: %s", buf);
}

dev_export(DEV_CLASS_SPI, "spi0", SPI_PORT0);
app_export(spi_example, NULL, "spi_example", 1024, 30, 1);
